﻿using System.Web;
using NExt.Handler.Base;
using NExt.Handler.Component.Common;
using NExt.Handler.Base.Default;

namespace NExt.Handler.Component.Default.RemoteMethod
{
    public class HandlerFactory: JsHandlerFactory
    {
        protected override IContentBuilder BuildContentBuilder()
        {
            IContentBuilder contentBuilder = new ResultContentBuilder();
            return contentBuilder;
        }

        public override bool CanHandle(HttpContext context, string requestType, string url, string pathTranslated)
        {
            if (requestType != "POST")
                return false;

            string postType = context.Request.Headers[HeaderKey.POST_TYPE];
            if (postType != "Method")
                return false;

            return true;
        }
    }
}
